<template>
	<view class="main">
		<view class="content">
			<view class="">{{ AfficheDetail.info }}</view>
			<view class="">
				<view class="">{{ AfficheDetail.add_time }}</view>
				<view class=""></view>
			</view>
			<view class="">
				<view class="">简介：{{ AfficheDetail.title }}</view>
			</view>
			<view class=""><image @click="imagePreview(index, AfficheDetail.images)" :src="item" mode="" v-for="(item, index) in AfficheDetail.images"></image></view>
		</view>
	</view>
</template>

<script>
import { homeAfficheDetail } from '@/api/api.js';
export default {
	data() {
		return {
			AfficheDetail: '',
			detailId: '',
			arr: []
		};
	},
	onLoad(options) {
		uni.showLoading({})
		this.detailId = options.id;
		this.homeAfficheDetail(options.id);
	},
	// 分享
	onShareAppMessage() {
		return {
			title: this.AfficheDetail.info,
			path: 'page_home/announcementdetail/announcementdetail?id=' + this.detailId
		};
	},
	// 分享到朋友圈
	onShareTimeline() {
		return {
			title: this.AfficheDetail.info,
			path: 'page_home/announcementdetail/announcementdetail?id=' + this.detailId
		};
	},
	methods: {
		homeAfficheDetail(id) {
			homeAfficheDetail(id).then(res => {
				if (res.data.code == '200') {
					uni.hideLoading()
					this.AfficheDetail = res.data.data;
				} else {
					uni.hideLoading()
				}
			});
		},
		// 图片预览
		imagePreview(index, images) {
			images.forEach(item => {
				this.arr.push(item);
			});
			uni.previewImage({
				current: index,
				urls: this.arr
			});
			this.arr = [];
		}
	}
};
</script>

<style lang="scss">
.main {
	padding: 30rpx;
}
.content {
	> view:nth-child(1) {
		font-size: 40rpx;
		font-weight: 700;
	}
	> view:nth-child(2) {
		display: flex;
		padding: 30rpx 0;
		font-size: 26rpx;
		color: #aaa;
		justify-content: space-between;
		align-items: center;
	}
	> view:nth-child(3) {
		border-radius: 20rpx;
		padding: 20rpx;
		background-color: #f5f7fa;
		margin-bottom: 40rpx;
	}
	> view:nth-child(4) {
		image {
			width: 100%;
		}
	}
}
</style>
